//
//  IceScoreController.m
//  WuJieLive
//
//  Created by 张瀚坤 on 2017/11/10.
//  Copyright © 2017年 zhk. All rights reserved.
//

#import "IceScoreController.h"
#import "IceScoreCell.h"
#import "IceScoreDetailController.h"

@interface IceScoreController ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UIButton *headerBtn;
@property (nonatomic , strong) HACursor * cursor;
@end

@implementation IceScoreController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

-(void)setNavi
{
    self.title = @"冻结积分";
    [self.rightBtn setImage:Image(@"icon_nav_说明") forState:(UIControlStateNormal)];
}

-(void)rightBtnAction:(UIButton *)sender
{
    
}

-(void)setUI
{
    self.view.backgroundColor = Color(245, 245, 245);
    self.headerBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 15, 0, 0);
    self.headerBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 30, 0, 0);
    
    NSArray * titleArray = @[@"冻结中",@"已到账",@"已失效"];
    self.cursor = [[HACursor alloc]init];
    self.cursor.frame = CGRectMake(0, 70, kScreenWidth, 45);
    self.cursor.titles = titleArray;
    self.cursor.pageViews = [self creatViews];
    self.cursor.titleNormalColor = TextLessImportColor;
    self.cursor.rootScrollViewHeight = kScreenHeight - 45 - 70 - 64;
    self.cursor.titleSelectedColor = [UIColor redColor];
    self.cursor.minFontSize = 14;
    self.cursor.maxFontSize = 14;
    self.cursor.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.cursor];
    
}

- (NSMutableArray *)creatViews
{
    NSMutableArray * array  = [NSMutableArray array];
    for (int i = 0; i < 3; i ++) {
        UITableView *tableview = [[UITableView alloc]init];
        tableview.backgroundColor = Color(245, 245, 245);
        tableview.separatorStyle = UITableViewCellSeparatorStyleNone;
        tableview.delegate = self;
        tableview.dataSource = self;
        tableview.tag = 1000 + i;
        [array addObject:tableview];
        if (tableview.tag == 1000) {
            [tableview registerNib:[UINib nibWithNibName:@"IceScoreCell" bundle:nil] forCellReuseIdentifier:@"cell1"];
            
        }else if (tableview.tag == 1001){
            [tableview registerNib:[UINib nibWithNibName:@"IceScoreCell" bundle:nil] forCellReuseIdentifier:@"cell2"];
        }else
        {
            [tableview registerNib:[UINib nibWithNibName:@"IceScoreCell" bundle:nil] forCellReuseIdentifier:@"cell3"];
        }
    }
    return array;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 150;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 20;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (tableView.tag == 1000) {
        IceScoreCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell1" forIndexPath:indexPath];
        //        [cell bindDataWithTpye:0];
        
        return cell;
    }else if (tableView.tag == 1001){
        IceScoreCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell2" forIndexPath:indexPath];
        //        [cell bindDataWithTpye:1];
        return cell;
    }else
    {
        IceScoreCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell3" forIndexPath:indexPath];
        //        [cell bindDataWithTpye:2];
        return cell;
    }
    return nil;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    IceScoreDetailController * vc = [[IceScoreDetailController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
